<%@ Page Language="C#" AutoEventWireup="true" Theme="YUI" CodeFile="ManagePlacements.aspx.cs"
    Inherits="Home_ManagePlacements" %>

<%@ Register Src="../UserControls/Menu.ascx" TagName="Menu" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>PlacementManager: Manage Placements</title>
    <link href="../App_Themes/YUI/tabber.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">

/* Optional: Temporarily hide the "tabber" class so it does not "flash"
   on the page as plain HTML. After tabber runs, the class is changed
   to "tabberlive" and it will appear. */

document.write('<style type="text/css">.tabber{display:none;}<\/style>');

/*==================================================
  Set the tabber options (must do this before including tabber.js)
  ==================================================*/
var tabberOptions = {

  'cookie':"tabberPlacementTypes", /* Name to use for the cookie */

  'onLoad': function(argsObj)
  {
    var t = argsObj.tabber;
    var i;

    /* Optional: Add the id of the tabber to the cookie name to allow
       for multiple tabber interfaces on the site.  If you have
       multiple tabber interfaces (even on different pages) I suggest
       setting a unique id on each one, to avoid having the cookie set
       the wrong tab.
    */
    if (t.id) {
      t.cookie = t.id + t.cookie;
    }

    /* If a cookie was previously set, restore the active tab */
    i = parseInt(getCookie(t.cookie));
    if (isNaN(i)) { return; }
    t.tabShow(i);
    //alert('getCookie(' + t.cookie + ') = ' + i);
  },

  'onClick':function(argsObj)
  {
    var c = argsObj.tabber.cookie;
    var i = argsObj.index;
    //alert('setCookie(' + c + ',' + i + ')');
    setCookie(c, i);
  }
};

/*==================================================
  Cookie functions
  ==================================================*/
function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}
function deleteCookie(name, path, domain) {
    if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    }
}

    </script>

    <script language="javascript" type="text/javascript" src="../scripts/tabber-minimized.js"></script>

    <script language="javascript" type="text/javascript">
     
    function showToolTip(e,text){ 
      var ToolTip = document.getElementById("ToolTip");
      ToolTip.innerHTML=text; 
      ToolTip.style.left=(e.clientX+15+document.body.scrollLeft)+'px'; 
      ToolTip.style.top=(e.clientY+document.body.scrollTop)+'px'; 
      ToolTip.style.display="block"; 
    } 
    function hideToolTip(){ 
        var ToolTip = document.getElementById("ToolTip");
        ToolTip.style.display="none"; 
    } 
    
    function showAddNote()
    {
        var divAddContact = document.getElementById("divAddNote");
        divAddContact.style.display = "block";
    }
    function hideAddNote()
    {
        var divAddContact = document.getElementById("divAddNote");
        divAddContact.style.display = "none";
    }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnableScriptGlobalization="True">
        </ajaxToolkit:ToolkitScriptManager>
        <div id="ToolTip" style="position: absolute; z-index: 1000; text-align: left; display: none;">
        </div>
        <div id="doc3" class="yui-t3">
            <div id="hd">
                <asp:Panel ID="pnlMenu" runat="server">
                    <uc1:Menu ID="Menu1" runat="server"></uc1:Menu>
                </asp:Panel>
            </div>
            <div id="bd">
                <div class="yui-b">
                    <h1>
                        Manage Placement Periods</h1>
                    <h2>
                        Placement Periods</h2>
                    <asp:UpdatePanel ID="updtpnlPlacementGrid" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:DropDownList ID="ddUnitFilter" runat="server" AppendDataBoundItems="True" AutoPostBack="True"
                                CssClass="dropdownlist" DataSourceID="odsUnits" DataTextField="UnitCode" DataValueField="UnitId"
                                ToolTip="Units" Width="80px" OnSelectedIndexChanged="ddUnitFilter_SelectedIndexChanged">
                                <asp:ListItem Value="0">All</asp:ListItem>
                            </asp:DropDownList><asp:DropDownList ID="ddCampusFilter" runat="server" AppendDataBoundItems="True"
                                AutoPostBack="True" CssClass="dropdownlist" DataSourceID="odsCampuses" DataTextField="CampusCode"
                                DataValueField="CampusId" ToolTip="Campuses" Width="50px" OnSelectedIndexChanged="ddCampusFilter_SelectedIndexChanged">
                                <asp:ListItem Value="0">All</asp:ListItem>
                            </asp:DropDownList><asp:DropDownList ID="ddSemesterFilter" runat="server" AutoPostBack="True"
                                CssClass="dropdownlist" ToolTip="Semesters" OnSelectedIndexChanged="ddSemesterFilter_SelectedIndexChanged">
                                <asp:ListItem Value="0">All</asp:ListItem>
                                <asp:ListItem Value="1">S1</asp:ListItem>
                                <asp:ListItem Value="2">S2</asp:ListItem>
                            </asp:DropDownList><asp:DropDownList ID="ddYearFilter" runat="server" AutoPostBack="True"
                                CssClass="dropdownlist" ToolTip="Years" OnSelectedIndexChanged="ddYearFilter_SelectedIndexChanged">
                                <asp:ListItem Value="0">All</asp:ListItem>
                                <asp:ListItem>2007</asp:ListItem>
                                <asp:ListItem>2008</asp:ListItem>
                                <asp:ListItem>2009</asp:ListItem>
                                <asp:ListItem>2010</asp:ListItem>
                            </asp:DropDownList>
                            <asp:ObjectDataSource ID="odsUnits" runat="server" OldValuesParameterFormatString="original_{0}"
                                SelectMethod="SelectAllWDivisionId" TypeName="PlacementManager.UnitComponent">
                                <SelectParameters>
                                    <asp:SessionParameter Name="DivisionId" SessionField="DivisionId" Type="Int32" />
                                    <asp:Parameter DefaultValue="UnitCode" Name="sortExpression" Type="String" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                            <asp:ObjectDataSource ID="odsCampuses" runat="server" OldValuesParameterFormatString="original_{0}"
                                SelectMethod="SelectAll" TypeName="PlacementManager.CampusComponent">
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="CampusCode" Name="sortExpression" Type="String" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                            <br />
                            <asp:GridView ID="gvPlacementTypes" runat="server" AllowPaging="True" AllowSorting="True"
                                AutoGenerateColumns="False" DataKeyNames="PlacementTypeId" DataSourceID="odsPlacementTypesView"
                                EmptyDataText="No placement types have been defined. Please use the form on the right to create a new placement type."
                                OnDataBound="gvPlacementTypes_DataBound" OnRowDataBound="gvPlacementTypes_RowDataBound"
                                OnSelectedIndexChanged="gvPlacementTypes_SelectedIndexChanged" PageSize="15"
                                SelectedIndex="0" SkinID="NavigationGrid" OnPageIndexChanged="gvPlacementTypes_PageIndexChanged">
                                <Columns>
                                    <asp:CommandField ButtonType="Image" SelectImageUrl="~/Images/Icons/edit.gif" ShowSelectButton="True" />
                                    <asp:BoundField DataField="UnitCode" HeaderText="Unit" SortExpression="UnitCode" />
                                    <asp:TemplateField HeaderText="Campus" SortExpression="CampusCode">
                                        <ItemTemplate>
                                            <asp:Label ID="lblCampus" runat="server" Text='<%# (Eval("CampusCode")) %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" />
                                    <asp:TemplateField HeaderText="Semester" SortExpression="SemesterId">
                                        <ItemTemplate>
                                            <asp:Label ID="lblSemester" runat="server" Text='<%# Eval("SemesterId") %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Name" SortExpression="PlacementTypeName">
                                        <ItemTemplate>
                                            <asp:Label ID="Label1" runat="server" Text='<%# Eval("PlacementTypeName").ToString() %>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                            <asp:ObjectDataSource ID="odsPlacementTypesView" runat="server" OldValuesParameterFormatString="original_{0}"
                                SelectMethod="SelectAllWFilters" SortParameterName="sortExpression" TypeName="PlacementManager.vwPlacementTypeComponent">
                                <SelectParameters>
                                    <asp:Parameter DefaultValue="true" Name="isActive" Type="Boolean" />
                                    <asp:ControlParameter ControlID="ddUnitFilter" DefaultValue="0" Name="unitId" PropertyName="SelectedValue"
                                        Type="Int32" />
                                    <asp:ControlParameter ControlID="ddCampusFilter" DefaultValue="0" Name="campusId"
                                        PropertyName="SelectedValue" Type="Int32" />
                                    <asp:ControlParameter ControlID="ddSemesterFilter" DefaultValue="0" Name="semesterId"
                                        PropertyName="SelectedValue" Type="Int32" />
                                    <asp:ControlParameter ControlID="ddYearFilter" DefaultValue="0" Name="year" PropertyName="SelectedValue"
                                        Type="Int32" />
                                    <asp:Parameter DefaultValue="0" Name="categoryId" Type="Int32" />
                                    <asp:Parameter DefaultValue="DateCreated" Name="sortExpression" Type="String" />
                                </SelectParameters>
                            </asp:ObjectDataSource>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="fvPlacementTypeDetails" EventName="ItemUpdated" />
                        </Triggers>
                    </asp:UpdatePanel>
                </div>
                <div id="yui-main">
                    <div class="yui-b">
                        <asp:UpdateProgress ID="updtprogDetails" runat="server" AssociatedUpdatePanelID="updtpnlPlacementGrid"
                            DisplayAfter="2" DynamicLayout="false">
                            <ProgressTemplate>
                                &nbsp; &nbsp;&nbsp;
                                <img alt="Progress" src="../Images/progressbar_long_green.gif" />
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                        <div class="tabber" id="mainTabset">
                            <div class="tabbertab">
                                <h2>
                                    Placement Type Details</h2>
                                <asp:UpdatePanel ID="updtpnlDetails" runat="server" UpdateMode="Conditional">
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="gvPlacementTypes" EventName="SelectedIndexChanged" />
                                    </Triggers>
                                    <ContentTemplate>
                                        <asp:FormView ID="fvPlacementTypeDetails" runat="server" DataSourceID="odsPlacementType"
                                            OnDataBound="fvPlacementTypeDetails_DataBound" OnItemUpdated="fvPlacementTypeDetails_ItemUpdated"
                                            OnItemUpdating="fvPlacementTypeDetails_ItemUpdating" Width="100%">
                                            <ItemTemplate>
                                                <span style="font-size: larger; font-weight: bold;">
                                                    <asp:Label ID="lblUnitCodeName" runat="server" Text='<%# GetUnitName(Eval("UnitId").ToString()) %>'></asp:Label></span>
                                                <table id="tblPT" class="AddEditPresentData">
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Status:</span></td>
                                                        <td colspan="3">
                                                            <asp:Label ID="lblStatus" runat="server" CssClass="status" Text='<%# GetStatus(Eval("PlacementTypeId").ToString()) %>'></asp:Label></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Name:</span></td>
                                                        <td>
                                                            <asp:Label ID="PlacementTypeNameLabel" runat="server" Text='<%# Bind("PlacementTypeName") %>'></asp:Label></td>
                                                        <td>
                                                            <span class="formLabel">Num students allocated:</span></td>
                                                        <td>
                                                            <asp:Label ID="lblNumStudentsAllocated" runat="server" Text="0"></asp:Label>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Year:</span></td>
                                                        <td>
                                                            <asp:Label ID="YearLabel" runat="server" Text='<%# Bind("Year") %>'></asp:Label></td>
                                                        <td>
                                                            <span class="formLabel">Semester:</span></td>
                                                        <td>
                                                            <asp:Label ID="SemesterIdLabel" runat="server" Text='<%# Bind("SemesterId") %>'></asp:Label></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Category:</span></td>
                                                        <td>
                                                            <asp:Label ID="lblCategoryName" runat="server" Text='<%# GetCategoryName(Eval("CategoryId").ToString()) %>'></asp:Label></td>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Start Date:</span></td>
                                                        <td>
                                                            <asp:Label ID="lblStartDate" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DateStart", "{0:dddd d MMMM yyyy}") %>'></asp:Label></td>
                                                        <td>
                                                            <span class="formLabel">End Date:</span></td>
                                                        <td>
                                                            <asp:Label ID="lblEndDate" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DateEnd", "{0:dddd d MMMM yyyy}") %>'></asp:Label></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Attendance Pattern:</span></td>
                                                        <td>
                                                            <asp:Label ID="lblAttendancePattern" runat="server" Text='<%# GetAttendancePattern(Eval("AttendancePatternId").ToString()) %>'></asp:Label></td>
                                                        <td>
                                                            <span class="formLabel">Required Hours:</span></td>
                                                        <td>
                                                            <asp:Label ID="RequiredHoursLabel" runat="server" Text='<%# Bind("RequiredHours") %>'></asp:Label></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Accrues Point:</span></td>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                        <td>
                                                            <span class="formLabel">Number of Points:</span></td>
                                                        <td>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Radius to Accrue Points:</span></td>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                        <td>
                                                            &nbsp;
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Created By:</span></td>
                                                        <td>
                                                            <asp:Label ID="CreatedByLabel" runat="server" Text='<%# Bind("CreatedBy") %>'></asp:Label></td>
                                                        <td>
                                                            <span class="formLabel">Date Created:</span></td>
                                                        <td>
                                                            <asp:Label ID="DateCreatedLabel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DateCreated", "{0:dddd d MMMM yyyy}") %>'></asp:Label></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span class="formLabel">Updated By:</span></td>
                                                        <td>
                                                            <asp:Label ID="UpdatedByLabel" runat="server" Text='<%# Bind("UpdatedBy") %>'></asp:Label></td>
                                                        <td>
                                                            <span class="formLabel">Date Updated:</span></td>
                                                        <td>
                                                            <asp:Label ID="DateUpdatedLabel" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "DateUpdated", "{0:dddd d MMMM yyyy}") %>'></asp:Label></td>
                                                    </tr>
                                                </table>
                                                <asp:Button ID="EditButton" CssClass="inputbutton" runat="server" Text="Edit" CausesValidation="False"
                                                    CommandName="Edit" ValidationGroup="vagrplEdit" />
                                            </ItemTemplate>
                                            <EditItemTemplate>
                                                <span style="font-size: larger; font-weight: bold;">
                                                    <asp:Label ID="lblUnitCodeName" runat="server" Text='<%# GetUnitName(Eval("UnitId").ToString()) %>'></asp:Label></span>
                                                <table id="tblEditPT" class="AddEditPresentData">
                                                    <tr>
                                                        <td class="LeftCol">
                                                            <span>Unit:<br />
                                                                <asp:DropDownList ID="ddEditUnit" runat="server" DataSourceID="odsUnits" DataTextField="UnitCode"
                                                                    DataValueField="UnitId" SelectedValue='<%# Bind("UnitId") %>'>
                                                                </asp:DropDownList></span></td>
                                                        <td style="width: 186px">
                                                            Group Name:<br />
                                                            <asp:TextBox ID="PlacementTypeNameTextBox" runat="server" Text='<%# Bind("PlacementTypeName") %>'></asp:TextBox></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span>Start Date:<br />
                                                                <asp:TextBox ID="DateStartTextBox" runat="server" MaxLength="10" Text='<%# DataBinder.Eval(Container.DataItem, "DateStart", "{0:d/MM/yyyy}") %>'
                                                                    Width="70px"></asp:TextBox><br />
                                                                <asp:Calendar ID="calStartDate" runat="server" CellPadding="0" OnSelectionChanged="calStartDate_SelectionChanged"
                                                                    SelectedDate='<%# Bind("DateStart") %>' VisibleDate='<%# Bind("DateStart") %>'></asp:Calendar>
                                                            </span>
                                                        </td>
                                                        <td style="width: 186px">
                                                            DateEnd:<br />
                                                            <asp:TextBox ID="DateEndTextBox" runat="server" MaxLength="10" Text='<%# DataBinder.Eval(Container.DataItem, "DateEnd", "{0:d/MM/yyyy}") %>'
                                                                Width="70px"></asp:TextBox><br />
                                                            <asp:Calendar ID="calEndDate" runat="server" CellPadding="0" OnSelectionChanged="calEndDate_SelectionChanged"
                                                                SelectedDate='<%# Bind("DateEnd") %>' VisibleDate='<%# Bind("DateEnd") %>'></asp:Calendar>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span>Semester:<br />
                                                                <asp:DropDownList ID="ddEditSemester" runat="server" SelectedValue='<%# Bind("SemesterId") %>'>
                                                                    <asp:ListItem Value="1">Semester 1</asp:ListItem>
                                                                    <asp:ListItem Value="2">Semester 2</asp:ListItem>
                                                                    <asp:ListItem Value="3">Semester 3</asp:ListItem>
                                                                </asp:DropDownList></span></td>
                                                        <td style="width: 186px">
                                                            &nbsp;Year:<br />
                                                            <asp:DropDownList ID="ddEditYear" runat="server" SelectedValue='<%# Bind("Year") %>'>
                                                                <asp:ListItem>2007</asp:ListItem>
                                                                <asp:ListItem>2008</asp:ListItem>
                                                                <asp:ListItem>2009</asp:ListItem>
                                                                <asp:ListItem>2010</asp:ListItem>
                                                            </asp:DropDownList></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span>RequiredHours:<br />
                                                                <asp:TextBox ID="RequiredHoursTextBox" runat="server" MaxLength="3" Text='<%# Bind("RequiredHours") %>'
                                                                    Width="40px"></asp:TextBox></span></td>
                                                        <td style="width: 186px">
                                                            AttendancePattern:<br />
                                                            <asp:DropDownList ID="ddEditAttendancePattern" runat="server" DataSourceID="odsAttendancePatterns"
                                                                DataTextField="AttendancePatternName" DataValueField="AttendancePatternId" SelectedValue='<%# Bind("AttendancePatternId") %>'>
                                                            </asp:DropDownList></td>
                                                    </tr>
                                                    <tr>
                                                        <td>
                                                            <span>Category:<br />
                                                                <asp:DropDownList ID="ddEditCategory" runat="server" DataSourceID="odsPlacementCategories"
                                                                    DataTextField="CategoryName" DataValueField="CategoryId" SelectedValue='<%# Bind("CategoryId") %>'>
                                                                </asp:DropDownList></span></td>
                                                        <td style="width: 186px">
                                                            Campus:<br />
                                                            <asp:DropDownList ID="ddEditCampus" runat="server" DataSourceID="odsPlacementCampuses"
                                                                DataTextField="CampusName" DataValueField="CampusId" SelectedValue='<%# Bind("CampusId") %>'>
                                                            </asp:DropDownList></td>
                                                    </tr>
                                                </table>
                                                <asp:Button ID="UpdateCancelButton" runat="server" CausesValidation="True" CommandName="Update"
                                                    Text="Update" CssClass="inputbutton" ValidationGroup="valgrpUpdatePT" />
                                                <asp:Button ID="UpdateButton" runat="server" Text="Cancel" CausesValidation="False"
                                                    CommandName="Cancel" CssClass="inputbutton" />
                                            </EditItemTemplate>
                                        </asp:FormView>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </div>
                            <div class="tabbertab">
                                <h2>
                                    Notes</h2>
                                <asp:UpdatePanel ID="updtpnlNotes" runat="server" UpdateMode="Conditional">
                                    <Triggers>
                                        <asp:AsyncPostBackTrigger ControlID="gvPlacementTypes" EventName="SelectedIndexChanged" />
                                        <asp:AsyncPostBackTrigger ControlID="btnSaveNote" EventName="Click" />
                                    </Triggers>
                                    <ContentTemplate>
                                        <asp:GridView ID="gvNotes" runat="server" AutoGenerateColumns="False" DataSourceID="odsComments"
                                            EmptyDataText="No notes have been added for this venue." ShowHeader="False" SkinID="Notes"
                                            Width="90%" DataKeyNames="NoteId" OnRowUpdating="gvNotes_RowUpdating" OnRowCommand="gvNotes_RowCommand">
                                            <Columns>
                                                <asp:TemplateField>
                                                    <ItemTemplate>
                                                        <hr style="height: 1px" />
                                                        <p>
                                                            Created On:
                                                            <asp:Label ID="lblCommentDateCreated" runat="server" Text='<%# Bind("DateCreated") %>'></asp:Label>
                                                            By:
                                                            <asp:Label ID="lblCommentCreatedBy" runat="server" Text='<%# Bind("CreatedBy") %>'></asp:Label>
                                                            <br />
                                                            Last Updated On:
                                                            <asp:Label ID="lblCommentDateUpdated" runat="server" Text='<%# Bind("DateUpdated") %>'></asp:Label>
                                                            By:
                                                            <asp:Label ID="lblCommentUpdatedBy" runat="server" Text='<%# Bind("UpdatedBy") %>'></asp:Label>
                                                        </p>
                                                        <br />
                                                        Comment:
                                                        <asp:Label ID="lblComment" runat="server" Text='<%# Bind("NoteText") %>'></asp:Label>
                                                        <br />
                                                        <asp:LinkButton ID="lbEdit" CommandName="Edit" runat="server">Edit</asp:LinkButton>
                                                        <asp:LinkButton ID="lbDelete" runat="server" CommandArgument='<%# Bind("NoteId") %>'
                                                            CommandName="DeleteNote">Delete</asp:LinkButton>
                                                        <ajaxToolkit:ConfirmButtonExtender ID="cbeDeleteNote" runat="server" ConfirmText="Are you sure that you want to delete this note?"
                                                            TargetControlID="lbDelete">
                                                        </ajaxToolkit:ConfirmButtonExtender>
                                                    </ItemTemplate>
                                                    <EditItemTemplate>
                                                        <asp:TextBox ID="txtEditNote" runat="server" Height="80px" MaxLength="8000" TextMode="MultiLine"
                                                            Width="90%" Text='<%# Bind("NoteText") %>'></asp:TextBox><br />
                                                        <asp:LinkButton ID="lbUpdate" CommandName="Update" runat="server">Update</asp:LinkButton>
                                                    </EditItemTemplate>
                                                </asp:TemplateField>
                                            </Columns>
                                        </asp:GridView>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                                <input id="btnShowAddNewNote" class="inputbutton" onclick="showAddNote();" type="button"
                                    value="Add New Note" />
                                <div id="divAddNote" style="display: none">
                                    <fieldset id="fldAddNote">
                                        <legend id="lgdAddNote">Add Note</legend>
                                        <asp:UpdatePanel ID="updtpnlNewNote" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
                                            <ContentTemplate>
                                                <asp:TextBox ID="txtAddNewNote" runat="server" Height="80px" MaxLength="8000" TextMode="MultiLine"
                                                    Width="90%"></asp:TextBox><br />
                                                <asp:Button ID="btnSaveNote" runat="server" CssClass="inputbutton" OnClick="btnSaveNote_Click"
                                                    Text="Save Note" />
                                                <input id="btnHideAddNote" class="inputbutton" onclick="hideAddNote();" type="button"
                                                    value="Cancel" />
                                            </ContentTemplate>
                                        </asp:UpdatePanel>
                                    </fieldset>
                                </div>
                            </div>
                            <div class="tabbertab">
                                <h2>
                                    New Placement Period</h2>
                                <asp:UpdatePanel ID="updtpnlInsertPT" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <table id="tblNewPT" class="AddEditPresentData">
                                            <tr>
                                                <td class="LeftCol" style="width: 50%">
                                                    <asp:Label ID="lblNewPTUnit" runat="server" Text="Unit:"></asp:Label><br />
                                                    <asp:DropDownList ID="ddNewPTUnit" runat="server" DataSourceID="odsUnits" DataTextField="UnitCode"
                                                        DataValueField="UnitId">
                                                    </asp:DropDownList></td>
                                                <td style="width: 50%">
                                                    <asp:Label ID="lblNewPTName" runat="server" Text="Name:"></asp:Label><br />
                                                    <asp:TextBox ID="txtNewPTName" runat="server" MaxLength="50"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ID="rfvNewPTName" runat="server" ControlToValidate="txtNewPTName"
                                                        CssClass="message" ErrorMessage="Please enter a name for the placement period."
                                                        ForeColor="" ValidationGroup="valgrpNewPT">*</asp:RequiredFieldValidator></td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblNewPTStartDate" runat="server" Text="Start Date:"></asp:Label><br />
                                                    <asp:TextBox ID="txtNewPtStartDate" runat="server" MaxLength="10" Width="70px"></asp:TextBox>
                                                    <asp:Calendar ID="calNewPTStartDate" runat="server" OnSelectionChanged="calNewPTStartDate_SelectionChanged">
                                                    </asp:Calendar>
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblNewPTEndDate" runat="server" Text="End Date:"></asp:Label><br />
                                                    <asp:TextBox ID="txtNewPTEndDate" runat="server" MaxLength="10" Width="70px"></asp:TextBox>
                                                    <asp:Calendar ID="calNewPTEndDate" runat="server" OnSelectionChanged="calNewPTEndDate_SelectionChanged">
                                                    </asp:Calendar>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblNewPTSemester" runat="server" Text="Semester:"></asp:Label><br />
                                                    <asp:DropDownList ID="ddNewPTSemester" runat="server">
                                                        <asp:ListItem Value="1">Semester 1</asp:ListItem>
                                                        <asp:ListItem Value="2">Semester 2</asp:ListItem>
                                                        <asp:ListItem Value="3">Semester 3</asp:ListItem>
                                                    </asp:DropDownList></td>
                                                <td>
                                                    <asp:Label ID="lblNewPTYear" runat="server" CssClass="formLabel" Text="Year:"></asp:Label><br />
                                                    <asp:DropDownList ID="ddNewPTYear" runat="server">
                                                        <asp:ListItem>2007</asp:ListItem>
                                                        <asp:ListItem>2008</asp:ListItem>
                                                        <asp:ListItem>2009</asp:ListItem>
                                                        <asp:ListItem>2010</asp:ListItem>
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblNewPTRequiredHours" runat="server" Text="Required Hours:"></asp:Label><br />
                                                    <asp:TextBox ID="txtNewPTRequiredHours" runat="server" MaxLength="3" Width="40px">0</asp:TextBox>
                                                    <ajaxToolkit:FilteredTextBoxExtender ID="filtbRequiredHours" runat="server" FilterType="Numbers"
                                                        TargetControlID="txtNewPTRequiredHours" ValidChars="0123456789" Enabled="True">
                                                    </ajaxToolkit:FilteredTextBoxExtender>
                                                </td>
                                                <td>
                                                    <asp:Label ID="lblNewPTAttendancePattern" runat="server" CssClass="formLabel" Text="Attendance Pattern:"></asp:Label><br />
                                                    <asp:DropDownList ID="ddNewPTAttendancePattern" runat="server" CssClass="dropdownlist"
                                                        DataSourceID="odsAttendancePatterns" DataTextField="AttendancePatternName" DataValueField="AttendancePatternId">
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblNewPTCategory" runat="server" Text="Category:"></asp:Label><br />
                                                    <asp:DropDownList ID="ddNewPTCategory" runat="server" DataSourceID="odsPlacementCategories"
                                                        DataTextField="CategoryName" DataValueField="CategoryId">
                                                    </asp:DropDownList></td>
                                                <td>
                                                    <asp:Label ID="lblNewPTCampus" runat="server" Text="Campus:"></asp:Label><br />
                                                    <asp:DropDownList ID="ddNewPTCampus" runat="server" DataSourceID="odsPlacementCampuses"
                                                        DataTextField="CampusName" DataValueField="CampusId">
                                                    </asp:DropDownList></td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblInsertAccruesPoints" runat="server" Text="Accrues Points:"></asp:Label><br />
                                                    <asp:CheckBox ID="cbInsertAccruesPoints" runat="server" AutoPostBack="True" OnCheckedChanged="cbInsertAccruesPoints_CheckedChanged" /></td>
                                                <td>
                                                    <asp:Label ID="lblInsertNumberOfPoints" runat="server" Text="Number of Points:"></asp:Label><br />
                                                    <asp:TextBox ID="txtNewNumberOfPoints" runat="server" Enabled="False" MaxLength="4"
                                                        Width="40px">0</asp:TextBox>
                                                    <ajaxToolkit:FilteredTextBoxExtender ID="filtbNumberPoints" runat="server" FilterType="Numbers"
                                                        TargetControlID="txtNewNumberOfPoints" ValidChars="0123456789" Enabled="True">
                                                    </ajaxToolkit:FilteredTextBoxExtender>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:Label ID="lblNewPointsRadius" runat="server" Text="Radius to Accrue Points:"></asp:Label>
                                                    <asp:TextBox ID="txtNewRadiusPoints" runat="server" Enabled="False" MaxLength="3"
                                                        Width="40px">100</asp:TextBox>Km</td>
                                                <td>
                                                </td>
                                            </tr>
                                        </table>
                                        <asp:Button ID="btnInsertNewPT" runat="server" CssClass="inputbutton" OnClick="btnInsertNewPT_Click"
                                            Text="Add New Placement Type" ValidationGroup="valgrpNewPT" /><br />
                                        <asp:Label ID="lblInsertMessage" runat="server" CssClass="message"></asp:Label>
                                        <br />
                                        <asp:ValidationSummary ID="valsumNewPT" runat="server" CssClass="message" ForeColor=""
                                            ValidationGroup="valgrpNewPT" />
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                                &nbsp;&nbsp;
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div id="ft">
                &nbsp;&nbsp;</div>
        </div>
        <!--
    ********************************************************************* 
    Object Data Sources 
    ********************************************************************* 
    -->
        <asp:ObjectDataSource ID="odsPlacementType" runat="server" DataObjectTypeName="PlacementManager.PlacementType"
            OldValuesParameterFormatString="original_{0}" SelectMethod="SelectOne" TypeName="PlacementManager.PlacementTypeComponent"
            UpdateMethod="Update">
            <SelectParameters>
                <asp:ControlParameter ControlID="gvPlacementTypes" Name="PlacementTypeId" PropertyName="SelectedValue"
                    Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
        
        <asp:ObjectDataSource ID="odsPlacementCategories" runat="server" OldValuesParameterFormatString="original_{0}"
            SelectMethod="SelectAllWDivisionId" TypeName="PlacementManager.CategoryComponent">
            <SelectParameters>
                <asp:SessionParameter Name="DivisionId" SessionField="DivisionId" Type="Int32" />
                <asp:Parameter DefaultValue="CategoryName" Name="sortExpression" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:ObjectDataSource ID="odsAttendancePatterns" runat="server" OldValuesParameterFormatString="original_{0}"
            SelectMethod="SelectAllWDivisionId" TypeName="PlacementManager.AttendancePatternComponent">
            <SelectParameters>
                <asp:SessionParameter Name="DivisionId" SessionField="DivisionId" Type="Int32" />
                <asp:Parameter DefaultValue="AttendancePatternName" Name="sortExpression" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:ObjectDataSource ID="odsPlacementCampuses" runat="server" OldValuesParameterFormatString="original_{0}"
            SelectMethod="SelectAll" TypeName="PlacementManager.CampusComponent">
            <SelectParameters>
                <asp:Parameter DefaultValue="CampusCode" Name="sortExpression" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
        <asp:ObjectDataSource ID="odsComments" runat="server" DataObjectTypeName="PlacementManager.Note"
            DeleteMethod="DeleteAllWNoteTypeId" InsertMethod="Insert" OldValuesParameterFormatString="original_{0}"
            SelectMethod="SelectAllWNoteTypeIdEntityId" TypeName="PlacementManager.NoteComponent"
            UpdateMethod="Update">
            <DeleteParameters>
                <asp:Parameter Name="NoteTypeId" Type="Int32" />
            </DeleteParameters>
            <SelectParameters>
                <asp:Parameter DefaultValue="3" Name="NoteTypeId" Type="Int32" />
                <asp:ControlParameter ControlID="gvPlacementTypes" DefaultValue="" Name="EntityId"
                    PropertyName="SelectedValue" Type="Int32" />
                <asp:Parameter DefaultValue="DateCreated" Name="sortExpression" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>
    </form>
</body>
</html>
